#ifndef FUNCTION_H
#define FUNCITON_H

#include <iostream>
#include <math.h>
#include <vector>
#include "point.hpp"

using namespace std;

class BoundaryFunc
{
public:
    BoundaryFunc() {}

    double operator()(double _x, double _y) { return exp(_y + sin(_x)); }

    double operator()(point _p) { return exp(_p.y + sin(_p.x)); }

    double f_x(point _p) { return cos(_p.x) * exp(_p.y + sin(_p.x)); }

    double f_y(point _p) { return exp(_p.y + sin(_p.x)); }

    double laplace_f(double _x, double _y)
    {
        double fxx = (-sin(_x) + pow(cos(_x), 2)) * exp(_y + sin(_x));
        double fyy = exp(_y + sin(_x));
        return fxx + fyy;
    }

    double laplace_f(point _p) { return laplace_f(_p.x, _p.y); }
};

class Function
{
private:
    BoundaryFunc _f;

public:
    Function() {}
    double operator()(point _p) { return -_f.laplace_f(_p); }
    double operator()(double _x, double _y) { return -_f.laplace_f(_x, _y); }
};
#endif